function showProducts(link){
	resetAllCells();
// gps_product.jsp
	Ext.get(link).parent().setStyle('font-weight','bold');
	var settingSpace = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
	settingSpace = settingSpace + settingSpace+ settingSpace;
	settingWin.setWidth(850);
	settingWin.setHeight(550);

	settingWin.setTitle(mamaneTitle+settingSpace+trackerInfo);
	if(settingWin.getEl().select('iframe').item(0).dom.contentWindow.showWaiting)
		settingWin.getEl().select('iframe').item(0).dom.contentWindow.showWaiting();
	settingWin.getEl().select('iframe').item(0).set({src:'./trackerList.jsp'});
	settingWin.show();
}

function ajustProducts(title, width, height, lines){
	var settingSpace = '';
	if(!lines) lines = 12;
	
	if(lines){
		for(var i = 0; i < lines; i++){
			settingSpace = settingSpace + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
		}
	}
	settingWin.setTitle(mamaneTitle+settingSpace+title);
	if(width) settingWin.setWidth(width);
	if(height) settingWin.setHeight(height);
	settingWin.center();
}


function setPassword(link){
	resetAllCells();
	// gps_password.jsp
		Ext.get(link).parent().setStyle('font-weight','bold');
		
		ajustProducts(change_password_title, 400,210, 6);
		settingWin.getEl().select('iframe').item(0).set({src:'./gps_password.jsp'});
		settingWin.show();
}

function setEmail(link){
	resetAllCells();
	// gps_email_setting.jsp
	Ext.get(link).parent().setStyle('font-weight','bold');
	
	ajustProducts(email_setting_title, 500,280, 10);
	settingWin.getEl().select('iframe').item(0).set({src:'./gps_email_setting.jsp'});
	settingWin.show();
}

function showUsers(link){
	resetAllCells();
	// users.jsp
	Ext.get(link).parent().setStyle('font-weight','bold');
	settingWin.setWidth(850);
	settingWin.setHeight(550);
	if(settingWin.getEl().select('iframe').item(0).dom.contentWindow.showWaiting)
		settingWin.getEl().select('iframe').item(0).dom.contentWindow.showWaiting();
	settingWin.getEl().select('iframe').item(0).set({src:'./userList.jsp'});
	settingWin.show();
}

function showUpgade(link){
	resetAllCells();
	Ext.get(link).parent().setStyle('font-weight','bold');
	settingWin.setWidth(450);
	settingWin.setHeight(200);
	if(settingWin.getEl().select('iframe').item(0).dom.contentWindow.showWaiting)
		settingWin.getEl().select('iframe').item(0).dom.contentWindow.showWaiting();
	settingWin.getEl().select('iframe').item(0).set({src:'./upgrade.jsp'});
	settingWin.show();
	
}


function resetAllCells(){
	Ext.get('manageMenu').select('td').each(function(item){
		item.setStyle('font-weight','');
	});
}

var trackerWin = null;
function showTrackerDetails(el, trackerId){
	//trackerWin.body = Ext.get('grid-trackers');
	var top = document.body.scrollTop;
	var url = "gps_trackerDetails.jsp";
	var config = {
		    url: url,
		    params: {trackerid: trackerId}, // or a URL encoded string
		    callback: function(g1,g2, res){ var text = res.responseText; if(text.indexOf('loginPage.jsp') > -1){ location.href = './login.jsp'; } },
		    discardUrl: false,
		    nocache: false,
		    text: 'Loading...',
		    timeout: 30,
		    scripts: true
		};
	if(trackerWin == null){
		trackerWin = new Ext.Window({width:560,bodyCssClass:'panel_whitebg', height:600, closeAction:'hide',title:trackerInfo, modal:false, applyTo:'detailWindow', cls:'panel_whitebg'});
	}
	trackerWin.load(config);
	trackerWin.setPosition(document.body.clientWidth / 2 -  trackerWin.getWidth() / 2, top);
	trackerWin.show();
}

var userWin = null;
function showUserDetails(el, userId){
	var top = document.body.scrollTop;
	var url = "user_detail.jsp";
	var config = {
		    url: url,
		    params: {userid: userId}, // or a URL encoded string
		    callback: function(g1,g2, res){ var text = res.responseText; if(text.indexOf('loginPage.jsp') > -1){ location.href = './login.jsp'; } },
		    discardUrl: false,
		    nocache: false,
		    text: 'Loading...',
		    timeout: 30,
		    scripts: false
		};
	if(userWin == null){
		userWin = new Ext.Window({width:560,bodyCssClass:'panel_whitebg', height:400, closeAction:'hide',title:userInfo, modal:false, applyTo:'userDetailWindow', cls:'panel_whitebg'});
	}
	userWin.load(config);
	userWin.setPosition(document.body.clientWidth / 2 -  userWin.getWidth() / 2, top);
	userWin.show();
}
